<%@ page language="java" contentType="text/html; charset=UTF-8" trimDirectiveWhitespaces="true"
    pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/views/include.inc.jsp"%> 
<a id="refreshJbsxBox2orgTree" rel="jbsxBox2orgTree"  target="ajax" href="${contextPath }/organization/tree"  style="display: none"></a>
<script type="text/javascript">
/**
 * 根据id自动局部刷新，用于organization页面
 * @param json
 */
function dialogReloadRel2Org(json){
	if (json.statusCode == DWZ.statusCode.ok) {
		$("#refreshAjaxBox2orgTree").click();
	}
	
	dialogReloadRel(json);
}
</script>
<a id="refreshAjaxBox2orgTree" rel="ajaxBox2orgTree" target="ajax" href="${contextPath}/organization/tree" style="display:none;"></a>
<dwz:paginationForm action="${contextPath}/organization/list/${parentId}" page="${page}" onsubmit="return divSearch(this, 'ajaxBox2orgList');">
	<input type="hidden" name=search_LIKE_name value="${param.search_LIKE_name}"/>
</dwz:paginationForm>
<form method="post" action="${contextPath }/organization/list/${parentId}" onsubmit="return divSearch(this, 'ajaxBox2orgList');">
	<div class="pageHeader">
		<div class="searchBar">
			<ul class="searchContent">
				<li>
					<label>部门名称：</label>
					<input type="text" name=search_LIKE_name value="${param.search_LIKE_name }"/>
				</li>
			</ul>
			<div class="subBar">
				<ul>						
					<li><div class="button"><div class="buttonContent"><button type="submit">搜索</button></div></div></li>
				</ul>
			</div>
		</div>
	</div>
</form>
<div class="pageContent">
	<div class="panelBar">
		<ul class="toolBar">
			<shiro:hasPermission name="Organization:view">
			<li><a iconClass="group" target="dialog" width="530" height="560" mask="true" href="${contextPath}/organization/view/{slt_uid}"><span>查看部门</span></a></li>
			</shiro:hasPermission>
			<shiro:hasPermission name="Organization:create">
			<li><a iconClass="group_add" target="dialog" rel="lookupParent2org_create" width="530" height="260" mask="true" href="${contextPath}/organization/create/${parentId}"><span>添加部门</span></a></li>
			</shiro:hasPermission>
			<shiro:hasPermission name="Organization:edit">
			<li><a iconClass="group_edit" target="dialog" rel="lookupParent2org_edit" width="540" height="260" mask="true" href="${contextPath }/organization/edit/{slt_uid}"><span>编辑部门</span></a></li>
			</shiro:hasPermission>
			<shiro:hasPermission name="Organization:delete">
			<li><a iconClass="group_delete" callback="dialogReloadRel2Org" target="ajaxTodo"  href="${contextPath }/organization/delete/{slt_uid}" title="确认要删除该部门?"><span>删除部门</span></a></li>
			</shiro:hasPermission>
			<shiro:hasPermission name="Organization:assign">
			<li><a iconClass="shield" target="dialog" width="380" height="560" mask="true" href="${contextPath }/organization/assign/{slt_uid}"><span>分配角色</span></a></li>
			</shiro:hasPermission>
		</ul>
	</div>
	<table class="table" layoutH="142" width="100%" rel="ajaxBox2orgList" >
		<thead>
			<tr>
				<th width="150">名称</th>
				<th width="150">部门描述</th>
				<th width="60" orderField="priority" class="${page.orderField eq 'priority' ? page.orderDirection : ''}">优先级</th>
				<th width="150">上级部门</th>
				
			</tr>
		</thead>
		<tbody>
			<c:forEach var="item" items="${orgList}">
			<tr target="slt_uid" rel="${item.id}">
				<td><a href="${contextPath}/organization/view/${item.id}" mask="true" target="dialog" width="540" height="560">${item.name}</a></td>
				<td>${item.description}</td>
				<td>${item.priority}</td>
				<td>${item.parent.name}</td>
			</tr>
			</c:forEach>
		</tbody>
	</table>
	
	<!-- 分页 -->
	<dwz:pagination page="${page}" begin="10" end="100" step="10" rel="ajaxBox2orgList" onchange="navTabPageBreak({numPerPage:this.value}, 'ajaxBox2orgList')"/>

	
</div>